package com.deke.course.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.deke.course.service.EduCheckService;
import com.deke.course.vo.CourseVo;
import com.deke.entity.EduCourse;
import com.deke.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 * @version 1.0
 * @Author :LiM
 * @Date :2022/12/11 21:06
 */
@RestController
@RequestMapping("/core/checkCourse")
@Api(tags = "课程审核接口类")
public class CourseCheckController {
    @Autowired
    private EduCheckService checkService;
    @ApiOperation(value = "根据条件分页查询课程列表信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageCurrent",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页显示的条数"),
    })
    @PostMapping("/findCourseCheck/{Current}/{pageSize}")
    public Result<IPage<EduCourse>> findsubject(@RequestBody CourseVo courseVo,
                                                @PathVariable(required = true) Integer Current,
                                                @PathVariable(required = true) Integer pageSize
    ){
        return checkService.findByConditionPage(courseVo,Current,pageSize);
    }


    /**
      * 修改
     * @Return
     * @Author Lim
     * @Date 2022/12/19 13:58
     */
    @PostMapping("/updateCourse")
    public Result updateCourse(@RequestBody CourseVo courseVo) {
        return checkService.updateCourse(courseVo);
    }

    @PostMapping("/updateCourseCheck")
    public Result updateCourseCheck(@RequestBody CourseVo courseVo) {
        return checkService.updateCourseCheck(courseVo);
    }

    /**
      * 修改上下架状态
     * @Return
     * @Author Lim
     * @Date 2022/12/21 12:44
     */
    @PostMapping("/changeStatus")
    public Result changeStatusId(@RequestBody Map map){
        return checkService.changeStatus(map);
    }
}
